<?php
/**
 * 前台路由文件
 */

//文章
Route::get('/articles/categories', 'ArticleController@categories');
Route::get('/articles', 'ArticleController@index');
Route::get('/articles/recommend', 'ArticleController@recommend');
Route::get('/articles/share/{id}', 'ArticleController@share');
Route::get('/articles/label', 'LabelController@index');
//评论列表
Route::get('/articles/{id}/comments', 'CommentController@index');
Route::get('/get-article/{id}', 'ArticleController@getArticle');
Route::post('get-article-relation', 'ArticleController@getArticleRelation');
// 个人网页详情
Route::get('/user-web-pack/get-detail', 'UserWebPageController@getDetail');
Route::post('share', 'ShareController@index');
Route::group(['middleware' => 'auth:api'], function () {

    //名片相关+++++++++++++++++++++++++++
    Route::group(['prefix' => 'card'], function () {
        //图文介绍
        Route::resource('/pictures', 'CardsPictureIntroductionsController');

        //视频介绍

        Route::resource('/videos', 'CardVideoIntroductionsController');

        //友情链接
        //网址链接
        Route::resource('/friendship/website', 'WebsiteController');
        //名片列表
        Route::resource('/friendship/', 'CardLinkController');

        //名片夹
        Route::get('/holder/record', 'CardHolderController@record');
        Route::get('/holder/page', 'CardHolderController@page');
        Route::get('/holder', 'CardHolderController@index');
        Route::post('/holder', 'CardHolderController@store');
        Route::delete('/holder', 'CardHolderController@destroy');
        Route::get('/info', 'CardController@getUserCardInfo');
    });
    //名片相关---------------------------


    Route::resource('/cards', 'CardController');

    //名片

    Route::post('/update-user-info', 'CardController@updateUserInfoCard');
    //相册
    Route::resource('/albums', 'AlbumController');
    //照片
    Route::resource('/photos', 'PhotoController');

    //个人中心++++++++++++++++++++++++++++++

    Route::group(['prefix' => 'profile'], function () {
        //用户基础信息
        Route::get('/', 'ProfileController@index');
        Route::get('/info', 'ProfileController@info');
        Route::post('/bind-phone', 'ProfileController@bindPhone');
        Route::get('/vip', 'VipController@index');
        Route::post('/vip/pay', 'VipController@pay');
        Route::post('/feedback', 'ProfileController@feedback');
        Route::get('/label', 'LabelController@userLabel');
        Route::post('/label', 'LabelController@userAddLabel');
        Route::post('/is-show-phone', 'ProfileController@isShowPhone'); // 手机是否显示
    });

    //个人中心------------------------------


    //账户++++++++++++++++++++++++++++++

    Route::group(['prefix' => 'account'], function () {
        Route::post('bind_phone', 'AccountController@bindPhone');
        Route::get('wallet', 'AccountController@wallet');
        Route::get('wallet/bill', 'AccountController@bill');
        Route::get('wallet/cash', 'AccountController@cashInfo');
        Route::post('wallet/cash', 'AccountController@cash');
        Route::post('shift-to', 'AccountController@shiftTo');
        Route::post('resetPaymentPwd', 'AccountController@resetPymPwd');
        Route::post('validatePaymentSms', 'AccountController@validatePymSms');
        Route::post('setPaymentPwd', 'AccountController@setPymPwd');
        Route::post('validateOldPhone', 'AccountController@validateOldPhone');
        Route::post('validatePymPwd', 'AccountController@validatePymPwd');


        Route::post('bindNewPhone', 'AccountController@changePhone');
    });

    //账户------------------------------

    //银行卡管理
    Route::resource('/bank-card', 'BankCardController');

    Route::post('/articles/{id}/comments', 'CommentController@store');

    // 个人网页详情
    Route::get('/user-web-pack/detail', 'UserWebPageController@detail');
    // 添加、修改保存logo
    Route::post('/user-web-pack/save-logo', 'UserWebPageController@saveLogo');
    // 添加、修改保存bannerwechat/payment
    Route::post('/user-web-pack/save-banner', 'UserWebPageController@saveBanner');
    // 修改logo和banner
    Route::post('/user-web-pack/update-logo-banner', 'UserWebPageController@updateLogoAndBanner');
    // 添加图文
    Route::post('/user-web-pack/add-content', 'UserWebPageController@addContent');
    // 编辑个人网页内容
    Route::post('/user-web-pack/edit-content', 'UserWebPageController@editContent');
    // 获取个人网页内容
    Route::get('/user-web-pack/get-content', 'UserWebPageController@getContent');
    // 内容排序，上下移动
    Route::post('/user-web-pack/sort', 'UserWebPageController@sort');
    //置顶
    Route::post('/user-web-pack/sort-header', 'UserWebPageController@sortHeader');
    // 删除个人网页
    Route::post('/user-web-pack/delete-content', 'UserWebPageController@deleteContent');

    //收藏文章
    Route::post('articles/{id}/favorite', 'ArticleFavoriteController@store');
    Route::delete('articles/favorite', 'ArticleFavoriteController@destroy');
    Route::get('articles/favorite', 'ArticleFavoriteController@index');

    // todo 新互推圈

    Route::group (['prefix' => 'inter_push'],function (){

        Route::get('/list','UserInterPushController@getUserInterPushList');
        Route::get ("/info/{id}", 'UserInterPushController@getUserInterPushById');
        Route::post("/add","UserInterPushController@saveUserInterPushRecord"); // 生成互推记录
        Route::get("/share_list", "UserInterPushController@getUserInterPushRecordList"); //分享列表
        Route::put ("/info_material","UserInterPushController@setInfoMeterial"); // 设置素材
        Route::put("/passive_share/{id}", "UserInterPushController@setPassiveUserInterPushShare"); // 分享被动匹配
        Route::get ("/get_info","UserInterPushController@getUserInterPush");// 获取自己的互推信息
        Route::post ("/msg","UserInterPushController@saveMsg"); // 消息提醒

    });

    //todo 互推圈
    Route::post('interpush/remind', 'InterPushController@remind');
    Route::get('interpush/report_info', 'InterPushController@report_info');
    Route::post('interpush/report', 'InterPushController@report');
    // 保存图片
    Route::post('/save-inter-push-info-img', 'InterPushController@saveInterPushUserInfoImg');
    // 判断图片是否存在
    Route::get('/judge-inter-push-info-img', 'InterPushController@judgeInterPushUserInfoImg');
    // 获取用户互推信息
    Route::get('/inter-push-info', 'InterPushController@InterPushUserInfo');
    // 获取互推用户列表
    Route::get('/inter-push-match-user-list', 'InterPushController@getInterPushMatchUserList');
    // 搜索互推用户
    Route::get('/inter-push-match-user', 'InterPushController@interPushMatchUser');
    // 获取用户分享记录
    Route::get('/complete-inter-push-match-user', 'InterPushController@getCompleteInterPushMatchUserList');
    // 修改分享状态
    Route::get('/update-inter-push-match-user-share', 'InterPushController@updateInterPushMatchUserShare');
    // 获取被动分享
    Route::get('/passive-inter-push-match-user', 'InterPushController@getPassiveInterPushMatchUserList');
    // 修改是否开启互推圈
    Route::get('/update-is-enabled-inter-push', 'InterPushController@isEnabledInterPushUserInfo');


    //个人网页
    Route::group(['prefix' => 'personal_page'], function () {

        //个人模板
        Route::get('/user_temp', 'PageTemplateController@user_temp');

        //用户模板内容
        Route::get('/user_temp/{id}', 'PageTemplateController@user_temp_content')->where('id', '[0-9]+');
        //用户添加模板
        Route::post('/user_temp', 'PageTemplateController@add_user_temp');
        //编辑用户模板
        Route::put('/user_temp/{id}', 'PageTemplateController@edit_user_temp')->where('id', '[0-9]+');
        //设置某个模板为默认
        Route::post('/user_default_temp/{id}', 'PageTemplateController@user_temp_default');
        //删除用户模板
        Route::delete('/user_temp/{id}', 'PageTemplateController@del_user_temp')->where('id', '[0-9]+');
        Route::get('/user_temp/record', 'PageTemplateController@record');
        Route::get('/user_temp/bycate', 'PageTemplateController@defaultByCate');
        Route::get('/custom/categories', 'PageTemplateController@custom_category');
        Route::get('/custom/components', 'PageTemplateController@custom_components');
        Route::get('/custom/components/{id}', 'PageTemplateController@custom_component');
        Route::post('/customs', 'PageTemplateController@add_custom');
        Route::get('/customs', 'PageTemplateController@custom_list');
        Route::put('/customs/{id}', 'PageTemplateController@edit_custom')->where('id', '[0-9]+');
        Route::delete('/customs/{id}', 'PageTemplateController@del_custom')->where('id', '[0-9]+');
        Route::get('/all', 'PageTemplateController@all');
        Route::get('/customs/background', 'PageTemplateController@custom_background');
        Route::post('/customs/clone', 'PageTemplateController@clone_custom');
        Route::post('/customs/pay', 'PageTemplateController@pay');
        Route::post('/customs/wechat_pay', 'WeChatController@pageTemplatePay');
    });

    //营销网页
    Route::get('/user-marketing','UserMarketingController@index');
    Route::post('/user-marketing', 'UserMarketingController@store');
    Route::put('/user-marketing/{id}', 'UserMarketingController@update');
    Route::delete('/user-marketing/{id}','UserMarketingController@destroy');
    //营销奖励明细
    Route::get('/reward/bill', 'MemberController@bill');

    //个人分类
    Route::get('index/user_category', 'CategoriesController@userCategory');
    Route::post('index/user_category', 'CategoriesController@addUserCategory');
    Route::post('index/advise_category', 'CategoriesController@addAdviseCategory');

    //关注
    Route::post('/follow/media/{id}', 'FollowController@followMedia');
    Route::post('/un_follow/media/{id}', 'FollowController@unFollowMedia');

    Route::post('/thumb/article/{id}', 'ArticleController@thumb');
    Route::post('/un_thumb/article/{id}', 'ArticleController@unThumb');
    Route::post('/thumb/comment/{id}', 'CommentController@thumb');
    Route::post('/un_thumb/comment/{id}', 'CommentController@unThumb');
    Route::post('/complaint/article/{id}', 'ArticleController@complaint');
    //首页关注
    Route::get('/index/follow/user', 'IndexController@followUser');
    Route::get('/index/follow/article', 'IndexController@followArticle');

    // 编辑视频地址
    Route::post('/add-movie', 'MovieController@add');
    Route::post('/edit-movie', 'MovieController@edit');
    Route::get('/delete-movie', 'MovieController@delete');
    Route::get('/list-movie', 'MovieController@lists');
    Route::get('/one-movie', 'MovieController@one');
    Route::get('/search-movie', 'MovieController@search');
    //
    Route::group(['prefix'=>'maibao'], function () {
        Route::get('/wallet', 'MaiBaoController@index');
        Route::get('/income', 'MaiBaoController@bill')->name('maibao.income');
        Route::get('/expenditure', 'MaiBaoController@bill')->name('maibao.expenditure');
        Route::get('/friend', 'MaiBaoController@friend');
        Route::post('/give/{id}', 'MaiBaoController@give')->where('id', '[0-9]+');
        Route::get('/goods', 'MaiBaoController@goods');
        Route::post('/remind/{id}', 'MaiBaoController@remind')->where('id', '[0-9]+');
        Route::post('/recharge', 'WeChatController@maibaoPay');
    });

    Route::post('/complaint', 'ComplaintController@store');
    Route::post('/pay','PayController@pay');
	Route::get('/pay-jssdk','PayController@jssdk');
});


//todo 互推圈浏览次数
Route::get("/inter_push/material/share","UserInterPushOperationController@interPushMaterialShare");//浏览量
Route::get("/inter_push/material/wechat_share","UserInterPushOperationController@weChatInterPushMaterialShare");//微信浏览量

Route::any("/jspay",'PayController@wxnotify');
Route::get('/get-web-policy','OssController@getWebPolicy');
Route::get('/aliyun-img-base','OssController@aliyunImgBase');
// 营销网页
Route::get('/user-marketing/{id}', 'UserMarketingController@show');
Route::post('/register', 'AuthController@register');

//登录注册
//Route::post('/register', 'AuthController@register');
Route::post('/login', 'AuthController@login');
Route::post('/refresh', 'AuthController@refresh');
Route::post('/login/phone', 'AuthController@phoneLogin');
Route::get('/logout', 'AuthController@logout');
Route::post('/phone-exist','AuthController@phoneExist');



Route::any('/wechat', 'WeChatController@server');
Route::get('/create-menu', 'WeChatController@createMenu');
Route::get('/get-menu', 'WeChatController@getMenu');
Route::get('/del-menu', 'WeChatController@delMenu');
Route::any('/oauth', 'WeChatController@oauth');
Route::any('/oauth-callback', 'WeChatController@oauth_callback');
Route::any('/get-wechat-code', 'WeChatController@getQrCode');
Route::get('/user-info/{id}', 'CardController@getUserInfoCard');
Route::get('/test', 'AuthController@test')->middleware('auth:api');
Route::any('/get-wechat-user-list', 'WeChatController@getWeChatUserList');

Route::get('/get-user-we-chat', 'WeChatController@getWeChatUser');

// 获取推荐人
Route::get('get-prom-user', 'MemberController@getPromUser');
Route::get('get-prom-user-amount', 'MemberController@getPromUserAmount');
// 微信支付成功返回
Route::any('/wechat/payment', 'WeChatController@weChatPayment');
Route::any('/wechat/callback', 'WeChatController@callBack');
Route::any('/wechat/maibao_callback', 'WeChatController@maibaoCallback');
Route::any('/wechat/clone_callback', 'WeChatController@cloneCallback');


Route::get('/card', 'CardController@getCard');
Route::get('/user', 'ProfileController@user');
// 获取微信jsSdkConfig

Route::get('/get-wechat-js-sdk-config', 'WeChatController@getWeChatJsSdkConfig');

// 获取配置
Route::get('/get-wechat-config','WeChatController@getWeChatConfig');

// 加盟申请
Route::post('/apply-message', 'CanvassBusinessController@applyMessage');

// 微信模板消息

Route::get('/send-wechat-msg', 'WeChatController@sendWeChatMsg');

Route::get('/test-redis', 'InterPushController@testRedis');
Route::post('/account/reset', 'AuthController@reset');
Route::get('/personal_page/get_user_temp', 'PageTemplateController@get_user_temp');
Route::get('/personal_page/default_template', 'PageTemplateController@default_temp');

//todo 错误日志
Route::post('/front-log', 'FrontLogController@addLog');
Route::get ('/front-log','FrontLogController@getLog');

// 图片
Route::get('/answer-img','WeChatController@answerImage');
Route::get('/test-wechat-upload','WeChatController@weChatUpdateImg');

Route::group(['prefix' => 'personal_page'], function () {
    //分类
    Route::get("/categories", 'PageTemplateController@categories');
    //所有系统模板
    Route::get('/templates', 'PageTemplateController@index');
    //系统模板内容
    Route::get('/temp_content/{id}', 'PageTemplateController@temp_content');
//个人网页
    Route::get('/customs/{id}', 'PageTemplateController@get_custom')->where('id', '[0-9]+');

});
//首页广告
Route::get('/index/slides', 'IndexController@slides');
Route::get('/index/recommend', 'IndexController@recommend');

// 获取视频地址
Route::post('/get-movie', 'MovieController@index');
Route::get('/personal_page/rank', 'PageTemplateController@rank');

//todo 全名推广

Route::get('/spread','SpreadController@index');
Route::post('/spread', 'SpreadController@store');
Route::put('/spread/{id}', 'SpreadController@update');
Route::get('/get_spread_list', 'SpreadController@getList');
Route::get('/spread/{id}', 'SpreadController@show');
Route::delete('/spread/{id}', 'SpreadController@destroy');
Route::get('/spread_share','SpreadController@saveSpreadShare');
Route::get('/spread_share_list','SpreadController@spreadShareList');
Route::get('/spread_share_num', 'SpreadController@spreadShareNum');
Route::get('/spread_browse_num','SpreadController@browseNum');
// 获取企业详情
Route::get ("/enterprise/{id}", "SpreadController@getEnterpriseById");
Route::get('test-av','WeChatController@test');


// todo 活动
Route::get('/user_activity_info','UserActivityController@getPosterUserInfo');
Route::post('/user_activity_info', 'UserActivityController@savePoster');
Route::post('/user_activity_amount', 'UserActivityController@saveUserActivityBill');

// todo 消息

Route::get("/message","MessageController@getMessageList");
Route::get ("/message/{id}", "MessageController@getMessageListById");
Route::post("/set_invite_staff","MessageController@setInviteStaff");
Route::get ("/message_num","MessageController@getMessageNum");

// todo app邀请会员网页
Route::post("/app_invitation_register", "AuthController@appInvitationRegister");

// app 版本更新
Route::get("/version", "VersionController@android");

//个人网页(不登录)
Route::get('/personal_page/byuserid', 'PageTemplateController@getListByUserId');
Route::get('/marketing/byuserid', 'UserMarketingController@getListByUserId');


Route::get('/testurc', 'UnifiedReturnCommissionController@TestURC');
